package com.navidove.appspotlight.model.bo;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

@Entity
@Table(name = "app_dictionary")
public class AppDictionary implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	
	public static final String DICTIONARY_TYPE_SOURCE = "SOURCE";
	public static final String DICTIONARY_TYPE_CATEGORY = "CATEGORY";

	private Long id;
	private String dictionaryType;
	private String dictionaryCode;
	private String dictionaryName;
	private Integer dictionarySeq;
	private Boolean enable;
	private Date crtAt;
	private Date updAt;

	@Id
	@SequenceGenerator(name = "generator", sequenceName = "app_dictionary_id_seq", allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "generator")
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	@Column(name = "dictionary_type", nullable = false, length = 20)
	public String getDictionaryType() {
		return this.dictionaryType;
	}

	public void setDictionaryType(String dictionaryType) {
		this.dictionaryType = dictionaryType;
	}

	@Column(name = "dictionary_code", nullable = false, length = 10)
	public String getDictionaryCode() {
		return this.dictionaryCode;
	}

	public void setDictionaryCode(String dictionaryCode) {
		this.dictionaryCode = dictionaryCode;
	}

	@Column(name = "dictionary_name", nullable = false, length = 50)
	public String getDictionaryName() {
		return this.dictionaryName;
	}

	public void setDictionaryName(String dictionaryName) {
		this.dictionaryName = dictionaryName;
	}

	@Column(name = "dictionary_seq", nullable = false)
	public Integer getDictionarySeq() {
		return this.dictionarySeq;
	}

	public void setDictionarySeq(Integer dictionarySeq) {
		this.dictionarySeq = dictionarySeq;
	}

	@Column(name = "enable", nullable = false)
	public Boolean getEnable() {
		return this.enable;
	}

	public void setEnable(Boolean enable) {
		this.enable = enable;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "crt_at", length = 29)
	public Date getCrtAt() {
		return this.crtAt;
	}

	public void setCrtAt(Date crtAt) {
		this.crtAt = crtAt;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "upd_at", length = 29)
	public Date getUpdAt() {
		return this.updAt;
	}

	public void setUpdAt(Date updAt) {
		this.updAt = updAt;
	}

	/**
	 * @see java.lang.Object#toString
	 * @return String
	 */
	public String toString() {
		return new ToStringBuilder(this).append("id", getId()).toString();

	}

	/**
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (obj == this) {
			return true;
		}
		if (obj.getClass() != getClass()) {
			return false;
		}
		AppDictionary rhs = (AppDictionary) obj;

		return new EqualsBuilder().append(getId(), rhs.getId()).isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(17, 37).append(getId()).toHashCode();
	}

}
